<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="theme-color" content="#1e3a8f">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="default">
    <meta name="apple-mobile-web-app-title" content="精英杂志">
    <link rel="manifest" href="/manifest.json">
    <link rel="icon" type="image/png" sizes="32x32" href="/images/icons/icon-32x32.png">
    <link rel="icon" type="image/png" sizes="16x16" href="/images/icons/icon-16x16.png">
    <link rel="apple-touch-icon" href="/images/icons/icon-152x152.png">
    
    <!-- PWA安装提示占位符 -->
    <div id="pwa-install-banner-container"></div>
    <title>{{ .Title }} | {{ .Site.Title }}</title>
    <link href="/vendor/bootstrap-lite.css" rel="stylesheet">
    <link href="/css/pwa-styles.css" rel="stylesheet">
    <link href="/css/pwa-install.css" rel="stylesheet">
    <link href="/css/mobile-optimization.css" rel="stylesheet">
    <style>
        .paywall { background: #f8f9fa; padding: 2rem; border-radius: 8px; margin: 2rem 0; }
        .invite-required { color: #dc3545; font-weight: bold; }
    </style>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <div class="container">
            <a class="navbar-brand" href="/">{{ .Site.Title }}</a>
            <div class="navbar-nav ms-auto">
                {{ if .Site.Params.inviteRequired }}
                <span class="nav-link invite-required">需邀请码注册</span>
                {{ end }}
                <a class="nav-link" href="/admin.html">管理</a>
            </div>
        </div>
    </nav>
    <main class="container my-5">
        {{ block "main" . }}{{ end }}
    </main>
    <script src="/vendor/bootstrap-lite.min.js"></script>
    <script src="/js/mirror-config.js"></script>
    <script src="/js/pwa-installer.js"></script>
    <script src="/js/pwa-install.js"></script>
    <script>
        // 页面加载完成后显示镜像信息和PWA安装提示
        document.addEventListener('DOMContentLoaded', function() {
            if (typeof window.showSiteRecommendation === 'function') {
                window.showSiteRecommendation();
            }
            if (typeof window.showMirrorInfo === 'function') {
                window.showMirrorInfo();
            }
            // 初始化PWA安装管理器
            if (typeof PWAInstallManager !== 'undefined') {
                window.pwaInstallManager = new PWAInstallManager();
                window.pwaInstallManager.init();
            }
        });
    </script>
    {{ block "scripts" . }}{{ end }}
</body>
</html>